<%--
  Created by IntelliJ IDEA.
  User: 10332
  Date: 2020/8/7
  Time: 2:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt"  prefix="T"%>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>添加考勤</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="${AppPath}/css/font.css">
    <link rel="stylesheet" href="${AppPath}/css/index.css">
    <script type="text/javascript" src="${AppPath}/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${AppPath}/js/index.js"></script>
    <link rel="stylesheet" href="${AppPath}/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${AppPath}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${AppPath}/layer/skin/default/layer.css">

</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="addForm">

            <div class="layui-form-item">
                <label for="className" class="layui-form-label">
                    <span class="x-red">*</span>班级名</label>
                <div class="layui-input-inline">
                    <select id="className" name="classId" class="valid">
                        <option value="${aClass.classId}">${aClass.className}</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="empName" class="layui-form-label">
                    <span class="x-red">*</span>讲师</label>
                <div class="layui-input-inline">
                    <select id="empName" name="empId" class="valid">
                        <option>请选择讲师</option>
                        <T:forEach items="${teachercourseList}" var="emp">
                            <option value="${emp.empId.empId}">${emp.empId.empName}</option>
                        </T:forEach>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="attendenceDate" class="layui-form-label">
                    <span class="x-red">*</span>日期</label>
                <div class="layui-input-inline">
                    <input type="date" id="attendenceDate" name="attendenceDate"  class="layui-input"></div>
            </div>

            <div class="layui-form-item">
                <label for="courseName" class="layui-form-label">
                    <span class="x-red">*</span>课程</label>
                <div class="layui-input-inline">
                    <select id="courseName" name="courseId" class="valid">
                        <option>请选择课程</option>
                        <T:forEach items="${teachercourseList}" var="course">
                            <option value="${course.courseId.courseId}">${course.courseId.courseName}</option>
                        </T:forEach>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="attendenceResult" class="layui-form-label">
                    <span class="x-red">*</span>结果</label>
                <div class="layui-input-inline">
                    <select id="attendenceResult" name="attendenceResult" class="valid">
                        <option value="到">到</option>
                        <option value="缺勤">缺勤</option>
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="save" class="layui-form-label"></label>
                <button id="save" type="button" onclick="addForm()" lay-filter="add" lay-submit="" class="layui-btn">批量增加</button>
                <button type="reset" class="layui-btn">重置</button>
            </div>
        </form>
    </div>
</div>
<script src="${AppPath}/jquery/jquery-2.1.1.min.js"></script>
<script src="${AppPath}/bootstrap/js/bootstrap.min.js"></script>
<script src="${AppPath}/script/docs.min.js"></script>
<script src="${AppPath}/layer/layer.js"></script>
<script>layui.use(['form', 'layer'],function () {});
//新增
function addForm(){
    $.ajax({
        url:"${AppPath}/attendence/adds",
        type:"post",
        data:$("#addForm").serialize(),
        success:function (data) {
            if(data.result=="ok"){
                layer.msg("添加成功",{time:1000, icon:1, shift:6},function () {
                    //关闭当前frame
                    xadmin.close();
                    // 可以对父窗口进行刷新
                    xadmin.father_reload();
                });
            }else{
                layer.msg(data.result, {time:1000, icon:2, shift:6},function () {});
            }
        }
    });
};
</script>
</body>

</html>
